package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum MessageEnum implements IEnum<Integer> {
    END_ORDER(0, "0-xc2TGJVfSnmaDwwgd_5eNADzEczf2dFjNjecIRSYw","订单通知"),
    END_PAY(1,  "cefb6A8k-DaNU15dDFkpJJOgZxXlDK3fD4lecpdJIGw","充值通知");

    private int type;

    private String name;

    private String cname;

    MessageEnum(int type, String name, String cname) {
        this.type = type;
        this.name = name;
        this.cname = cname;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static MessageEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static MessageEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equalsIgnoreCase(name)).findFirst().orElse(null);
    }
}

